package
{
	import flash.events.Event;
	import flash.net.SharedObject;
	import flash.utils.Dictionary;
	
	import org.flixel.*;
	
    [SWF(width="700", height="640", backgroundColor="#FFFFFF")] //Set the size and color of the Flash file
	[Frame(factoryClass="Preloader")]
	
	public class Elemental extends FlxGame
	{
		
		public static const DEBUG:Boolean = FlxG.debug;
		
		// Game modes.
		public static const NORMAL_MODE:int = 91605;
		public static const FACEBOOK_MODE:int = 34238;
		public static var MODE:int = NORMAL_MODE;
		
		//Primary Elements
		public static const NORMAL:int = 0;
		public static const EARTH:int = 1;
		public static const LIGHT:int = 2;
		public static const WATER:int = 4;
		public static const WIND:int = 8;
		
		//Secondary Elements
		public static const SAND:int = 3;
		public static const MUD:int = 5;
		public static const STEAM:int = 6;
		public static const LIGHTNING:int = 9;
		public static const FIRE:int = 10;
		public static const ICE:int = 12;
		
		//Tertiay Elements
		public static const WOOD:int = 7;
		public static const METAL:int = 11;
		public static const GLASS:int = 13;
		public static const RAINBOW:int = 14;
		
		//Super Element
		public static const VOID:int = 15;
		

		//Whether or not the Player and Monsters are Frozen
		public static var FREEZE:Boolean;
		
		//The Maps and the Text for the story
		public static var Maps:Dictionary;
		public static var Trains:Dictionary;
		public static var Arrows:Dictionary;
		
		public static var SText:Dictionary;
		public static var TText:Dictionary;
		public static var EText:Dictionary;
		public static var NPCs:Dictionary;
		
		public static var achievements:AchievementSystem;
		
		public static var fbInfo:FaceBook;
		public static var friendBar:FriendBar;
		
		//log
		public static var Log:Logging;
		
		public static var CurrentPlay:String = Res.forest;
		
		public function Elemental()
		{
			if (Elemental.MODE == Elemental.FACEBOOK_MODE) {
				fbInfo = new FaceBook("username", "uid", "Firstname Lastname", FaceBook.ACCESS_TOKEN);
				friendBar = new FriendBar(PlayerRoomState.FRIEND_BAR_X, PlayerRoomState.FRIEND_BAR_Y);
				achievements = new AchievementSystem();
			}
			
			//logging here
			Log = new Logging();
			
			//Initialize Dictionaries.
			Maps = new Dictionary();
			Trains = new Dictionary();
			Arrows = new Dictionary();
			SText = new Dictionary();
			TText = new Dictionary();
			EText = new Dictionary();
			NPCs = new Dictionary();
			
			//Set Up Map Properties
			Maps[0] = Res.MapZero;
			SText[0] = new Array();
			EText[0] = new Array();
			TText[0] = new Array();
			Trains[0] = new Array(1,1,1,1,1);
			Arrows[0] = new Array(3,3,3,3);
			NPCs[0] = new Array();
			Maps[1] = Res.MapOne;
			SText[1] = new Array("magnifico", "Hello! I'm Elder Magnifico. Can you help us?  We’re facing a crisis: many Elemental sources are darkening throughout the land.\n\nThis is terrible news for us Poofs!",
				"magnifico", "The Council decided to send out Poofs like you to relight these darkened Sources. I will be training you to do that.",
				"magnifico", "On the left is a darkened Light source.\nOn the right is a normal Light source.",
				"magnifico", "If you put an Arrow on the normal Light source, you can direct a Light beam to the darkened Light source.");
			EText[1] = new Array("magnifico", "Magnifico: Hmmm… Seems like you succeeded: I suppose I should praise you ...",
				"magnifico", "Magnifico: On to the next level!");
			TText[1] = new Array("Move with W/A/S/D.",
				"While standing on the Light Source, click on an arrow to place it there.",
				"Click on an arrow in the game to pick it up.");
			Trains[1] = new Array();
			Arrows[1] = new Array(0,0,1,0);
			NPCs[1] = new Array("magnifico", "Magnifico: If you need extra help, you should look at the Hint Box on the right.");
			Maps[2] = Res.MapTwo;
			SText[2] = new Array("magnifico", "Magnifico: Here's a dry Water source instead.  Send a beam from the normal Water source over to the dry Water source.", 
				"magnifico", "Magnifico: Seems like you have to bend the beam to reach that dry Water source.");
			EText[2] = new Array("magnifico", "Magnifico: Don’t get too full of yourself just because you’ve had a little success.");
			TText[2] = new Array("Place an arrow on a beam to change the beam's direction.",
				"You can click an arrow in the game to pick it up."); 
			Trains[2] = new Array();
			Arrows[2] = new Array(1,1,2,0);
			NPCs[2] = new Array("magnifico", "Magnifico: Don't forget about the hint box for help.  It has amazing information.");
			Maps[3] = Res.MapThree;
			SText[3] = new Array("magnifico", "Magnifico: See that object down there with the flashing lights? That’s a Source Forge.",
				"magnifico", "Magnifico: If you direct a Source Beam on it, and stand on it, you can become an Elemental!",
				"magnifico", "If you’re the right type of Elemental, you can restore a Darkened Source for that Element.");
			EText[3] = new Array("magnifico", "Magnifico: Wow, you’re only half the scrawny weakling you used to be. I credit myself.");
			TText[3] = new Array("Direct an Earth Beam onto the Source Forge. Become an Earth Elemental by standing on the activated Source Forge.",
				"Stand on a Darkened Source as the correct type of Elemental to light it.");
			Trains[3] = new Array();
			Arrows[3] = new Array(0,1,0,0);
			NPCs[3] = new Array("magnifico", "Magnifico: You would look better as an Earth Elemental. Shoot an Earth Beam to the Source Forge.");
			Maps[4] = Res.MapFour;
			SText[4] = new Array("magnifico", "Magnifico: Hrm ... fixing that Wind Source seems kind of challenging.");
			EText[4] = new Array("magnifico", "Magnifico: Yeah, I figured that out way before you.");
			TText[4] = new Array();
			Trains[4] = new Array();
			Arrows[4] = new Array(1,1,1,0);
			NPCs[4] = new Array("magnifico", "Magnifico: I'm starting to gain a little respect for you. Oh, respect for YOU? No no ... I was talking to that butterfly.");
			Maps[5] = Res.MapFive;
			SText[5] = new Array("magnifico", "Magnifico: I'll have to leave you soon, but first I’ll leave you with some final teachings.",
				"magnifico", "Magnifico: If you combine multiple Source Beams on the Source Forge, you can change into different types of Elementals.\n\nThis helps you get past certain obstacles, like that mud pit down there.");
			EText[5] = new Array("magnifico", "Magnifico: Seems like you got it! To review any elemental combinations, click on the Combos scroll " +
				"down there.");
			TText[5] = new Array("Direct two Source Beams to the forge to change into a different type of Elemental.",
				"The combination of Earth and Water makes Mud.",
				"You can pick up an arrow you placed in the game by clicking on it.");
			Trains[5] = new Array();
			Arrows[5] = new Array(1,1,0,0);
			NPCs[5] = new Array("magnifico", "Magnifico: Don't forget to restore the dead Wind source!");
			Maps[6] = Res.MapSix;
			SText[6] = new Array();
			EText[6] = new Array();
			TText[6] = new Array("You can shoot Source Beams past Obstacles.");
			Trains[6] = new Array();
			Arrows[6] = new Array(1,0,0,0);
			NPCs[6] = new Array("child", "Poof Child: Mama says I shouldn’t play with the Sources or I’ll get in trouble.");
			Maps[7] = Res.MapSeven;
			SText[7] = new Array();
			EText[7] = new Array();
			TText[7] = new Array("A Relit Source stays lit.", "To relight a Source you must shoot the correct Elemental Source Beam into it.",
				"A Water Beam will only relight a Water Source, and not an Earth, Air, or Wind Source.");
			Trains[7] = new Array();
			Arrows[7] = new Array(1,1,0,1);
			NPCs[7] = new Array("child", "Poof Child: Mama says I shouldn’t play with the Sources or I’ll get in trouble.");
			Maps[8] = Res.MapEight
			SText[8] = new Array("poofMale", "RomePoof: You’ll see JuliPoof, once I go to the Capital I’ll be a real big shot. I could probably even get promoted to the rank of " +
				"supreme Source paper filler outer. I’ll make a name for myself, you’ll see.", "poofFemale", "JuliPoof: But, I like the name you have.");
			EText[8] = new Array("poofFemale", "JuliPoof: Now if only RomePoof would return.");
			TText[8] = new Array("Light and Wind makes Fire", "Remember, you can relight a Darkened Source by stepping on it as the right type of Elemental.", "You cannot place Arrows on Obstacles.");
			Trains[8] = new Array();
			Arrows[8] = new Array(2,1,1,2);
			NPCs[8] = new Array("poofFemale", "JuliPoof: He would have never thought of leaving if our Water Source hadn’t Darkened. I would restore it myself, but that lava lake is in the way.",
				"poofMale", "RIGHT");
			Maps[9] = Res.MapNine;
			SText[9] = new Array("poofMale", "RomePoof: Hmm, those lakes look a bit treacherous. As all Poofs know, a Poof in water is like a fish out of it.");
			EText[9] = new Array("poofMale", "RomePoof: Well that’s just brilliant! What’s that? The capital is the other way and you fixed the Water Source in my village?! Seems I best return.");
			TText[9] = new Array("Water and Wind makes Ice");
			Trains[9] = new Array();
			Arrows[9] = new Array(3,2,1,3);
			NPCs[9] = new Array("poofMale", "RomePoof: I've heard Water + Wind combined on the Source Forge make Ice, But I'm the only one who knows JuliPoof + I make love.");
			Maps[10] = Res.MapTen;
			SText[10] = new Array();
			EText[10] = new Array();
			TText[10] = new Array("Water and Light makes Steam");
			Trains[10] = new Array();
			Arrows[10] = new Array(1,1,1,1);
			NPCs[10] = new Array();
			Maps[11] = Res.MapEleven;
			SText[11] = new Array("farmer", "Poof Farmer: Our Earth Source went dark. How will we feed the chickens with no Earth Source?",
				"villageLeader", "Poof Village Leader: Now you know we can’t just do things without the Council’s approval. I’ll submit the proper applications and I’m sure they’ll get back to us within the next year.",
				"farmer", "Poof Farmer: Ohhhh, but the chickens.");
			EText[11] = new Array("villageLeader", "Poof Village Leader: Hmm, I see, well, hmm… I better go fill out the necessary paperwork for this incident.",
				"farmer", "Poof Farmer: Oh, you saved my chickens. Chickens are such noble creatures: They never forget a debt.");
			TText[11] = new Array("Wind and Earth makes Lightning.",
				"You can interact with other Poofs by walking up to them.");
			Trains[11] = new Array();
			Arrows[11] = new Array(1,1,1,1);
			NPCs[11] = new Array("farmer", "Poof Farmer: Will you save the chickens?", "villageLeader", "Poof Village Leader: Did you fill out your loitering form? I'm afraid I can't let you loiter without a completed loitering form.");
			Maps[12] = Res.MapTwelve;
			SText[12] = new Array("child", "Run away Monsters!!");
			EText[12] = new Array();
			TText[12] = new Array("Throw chickens by pressing space bar. You can use them to scare away monsters, but you’ll lose the chicken.",
			"If a monster gets too close it will eat you. Be careful!");
			Trains[12] = new Array("1");
			Arrows[12] = new Array(1,1,0,1);
			NPCs[12] = new Array("child", "Poof Child: Mama says you can throw chickens past obstacles, but she also said I shouldn't throw chickens.", "child", "LEFT");
			Maps[13] = Res.MapThirteen;
			SText[13] = new Array();
			EText[13] = new Array();
			TText[13] = new Array("Press R to restart level or hit the restart button next to the mute button.", "You can review which combination of Sources make which Element by clicking on the Combo Scroll " +
				"button in the lower right corner.");
			Trains[13] = new Array();
			Arrows[13] = new Array(1,0,1,1);
			NPCs[13] = new Array("farmer", "Farmer: They say ghosts wander out on the Wastes and they come here to steal our Sources. I wouldn’t keep going this way if I were you. Ghosts are scary!");
			Maps[14] = Res.MapFourteen;
			SText[14] = new Array("villageLeader", "Village Leader: Everyone leave quickly, the Monsters are here!");
			EText[14] = new Array("villageLeader", "Village Leader: Thanks to you we can return to our houses... Not that there's much to return to anymore.");
			TText[14] = new Array("Press Space Bar to throw Chickens.", "You can throw Chickens over Obstacles.");
			Trains[14] = new Array(1,1,1,1);
			Arrows[14] = new Array(1,2,1,1);
			NPCs[14] = new Array("villageLeader", "Poof Village Leader: What, the Council sent you? No one has been out here for years. We thought they abandoned us",
				"farmer", "Poof Farmer: Most Poofs left when we lost our Light Source. Our crops wouldn’t grow and everyone was hungry.");
			Maps[15] = Res.MapFifteen;
			SText[15] = new Array("maskedPoof", "...");
			EText[15] = new Array();
			TText[15] = new Array("Light and Earth makes Sand", "If you get stuck press R to restart the level or the restart button located next to the mute button.");
			Trains[15] = new Array("1");
			Arrows[15] = new Array(1,1,1,2);
			NPCs[15] = new Array("farmer", "Poof Frontiermen: : Did you see that masked Poof? He just stole our Light Source. I would go after him, " +
				" but the Wastes are a scary place without some chickens.", "maskedPoof", "RIGHT");
			Maps[16] = Res.MapSixteen;
			SText[16] = new Array("poofMale", "Poof Frontierman: This must be the worst storm in years. What's that Masked Poof doing?");
			EText[16] = new Array("poofMale", "Poof Frontierman: You're going to follow that Masked Poof? Do whatever you want, but I can't take this place anymore.");
			TText[16] = new Array();
			Trains[16] = new Array("1");
			Arrows[16] = new Array(3,2,3,2);
			NPCs[16] = new Array("Poof Frontierman", "This sand is more abrasive than wool!", "maskedPoof", "DOWN");
			//NPC's and Masked Poof
			Maps[17] = Res.MapSeventeen;
			SText[17] = new Array("maskedPoof", "...");
			EText[17] = new Array();
			TText[17] = new Array();
			Trains[17] = new Array();
			Arrows[17] = new Array(2,1,2,2);
			NPCs[17] = new Array("maskedPoof", "RIGHT");
			//NPC's and Masked Poof
			Maps[18] = Res.MapEighteen;
			SText[18] = new Array("maskedPoof", "...");
			EText[18] = new Array("oldWastePoofFemale", "Old Poof Woman: Much obliged!");
			TText[18] = new Array();
			Trains[18] = new Array();
			Arrows[18] = new Array(1,1,1,1);
			NPCs[18] = new Array("oldWastePoofFemale", "Old Poof Woman: Ah, that darned Masked Poof is always stealing my Earth Source; " +
				"	my old wool just doesn’t have what it takes anymore. Would you be a dear and help an old Poof out?", "maskedPoof", 
			"LEFT");
			//NPC's and Masked Poof
			Maps[19] = Res.MapNineteen;
			SText[19] = new Array("maskedPoof", "...");
			EText[19] = new Array();
			TText[19] = new Array();
			Trains[19] = new Array();
			Arrows[19] = new Array(1,0,0,1);
			NPCs[19] = new Array("oldWastePoofMale", "Desert Poof: Living in the Wastes is hard enough" +
				" without that masked Poof stealing the few Sources we have.", "maskedPoof", "RIGHT");
			//NPC's and Masked Poof
			Maps[20] = Res.MapTwenty;
			SText[20] = new Array("oldWastePoofMale","Old Waste Poof: Be careful out there, you can barely see the dangerous crushers through all the sand.");
			EText[20] = new Array("oldWastePoofMale", "Old Waste Poof: Thank you, I can finally breathe a little easier knowing those metal contraptions aren't going " +
				"to smash me.");
			TText[20] = new Array("Earth, Air, and Light make Metal");
			Trains[20] = new Array("1");
			Arrows[20] = new Array(3,1,0,5);
			NPCs[20] = new Array("oldWastePoofMale", "Sandstorms are normal in the Waste... Crushers on the other hand...", "maskedPoof", "RIGHT");
			//NPC's and Masked Poof
			Maps[21] = Res.MapTwentyOne;
			SText[21] = new Array("maskedPoof", "The Masked Poof: Would you stop following me?");
			EText[21] = new Array();
			TText[21] = new Array();
			Trains[21] = new Array(1,1,1,1);
			Arrows[21] = new Array(1,1,0,2);
			NPCs[21] = new Array("maskedPoof", "RIGHT");
			//NPC's and Masked Poof
			Maps[22] = Res.MapTwentyTwo;
			SText[22] = new Array("maskedPoof","The Masked Poof: I’m serious, you should stop following me. I work for a big organization that eats Poofs like you for breakfast.");
			EText[22] = new Array();
			TText[22] = new Array("Light, Water, and Earth make Wood");
			Trains[22] = new Array(1,1);
			Arrows[22] = new Array(3,0,1,1);
			NPCs[22] = new Array("maskedPoof", "UP");
			Maps[23] = Res.MapTwentyThree;
			SText[23] = new Array("maskedPoof","The Masked Poof: You obviously are having a hard time understanding me, but maybe these crushers will discourage you.");
			EText[23] = new Array();
			TText[23] = new Array();
			Trains[23] = new Array();
			Arrows[23] = new Array(1,2,3,1);
			NPCs[23] = new Array("maskedPoof", "LEFT");
			Maps[24] = Res.MapTwentyFour;
			SText[24] = new Array("maskedPoof","The Masked Poof: Seems the crushers weren’t good enough ehhh, but you’ll think twice before trying to cross over those chasms. " +
				"	They say that they have no bottom. You just keep falling… forever…");
			EText[24] = new Array();
			TText[24] = new Array();
			Trains[24] = new Array();
			Arrows[24] = new Array(0,1,2,1);
			NPCs[24] = new Array("maskedPoof", "UP");
			Maps[25] = Res.MapTwentyFive;
			SText[25] = new Array("maskedPoof", "The Masked Poof: You must think you’re pretty clever, but these lasers will stop you in your tracks. I bet you don’t even know " +
				"what a laser is. Well, it’s a… it’s a… you can clearly see it. I don’t have to answer this.");
			EText[25] = new Array();
			TText[25] = new Array("Earth, Wind, and Water makes Glass");
			Trains[25] = new Array("1");
			Arrows[25] = new Array(2,2,1,2);
			NPCs[25] = new Array("maskedPoof", "DOWN");
			Maps[26] = Res.MapTwentySix;
			SText[26] = new Array("maskedPoof", "The Masked Poof: So I know why I’m out this far into the Wastes, but I’m starting to wonder about you. " +
				"	Is it your job? Because I don’t think they’re paying you enough, there are scary monsters you know.");
			EText[26] = new Array();
			TText[26] = new Array();
			Trains[26] = new Array(1,1,1,1);
			Arrows[26] = new Array(1,1,1,1);
			NPCs[26] = new Array("maskedPoof", "RIGHT");
			Maps[27] = Res.MapTwentySeven;
			SText[27] = new Array("maskedPoof","The Masked Poof: Why am I stealing Sources? You Poofs from the capital really don’t know anything about what’s out beyond the Wastes do you. " +
				"	If you think a few Darkened Sources are a concern you’ve got your wool on backwards.");
			EText[27] = new Array();
			TText[27] = new Array("Light, Water, and Wind make Rainbow");
			Trains[27] = new Array();
			Arrows[27] = new Array(2,1,1,2);
			NPCs[27] = new Array("maskedPoof", "UP");			
			Maps[28] = Res.MapTwentyEight;
			SText[28] = new Array("maskedPoof", "The Masked Poof: I was being nice up until now, but you really shouldn’t follow me any further. You might think you can help, " +
				"but you really can’t. I like you, I really do, but you should go back.");
			EText[28] = new Array();
			TText[28] = new Array();
			Trains[28] = new Array(1,1);
			Arrows[28] = new Array(1,2,0,2);
			NPCs[28] = new Array("maskedPoof", "LEFT");
			Maps[29] = Res.MapTwentyNine;
			SText[29] = new Array("maskedPoof", "The Masked Poof: You’re a resilient one, but this is our secret lair. Needless to say we weren’t light on the booby traps. " +
				"If you can fix this Light Source you’ll be able to get inside. Though I should warn you, there are about a billion ferocious monsters just out of sight.");
			EText[29] = new Array();
			TText[29] = new Array();
			Trains[29] = new Array();
			Arrows[29] = new Array(1,1,1,1);
			NPCs[29] = new Array("maskedPoof", "UP");
			Maps[30] = Res.MapThirty;
			SText[30] = new Array();
			EText[30] = new Array("resistanceLeader", "Oh, a Poof from the Council. So the Council still exists does it? Seeing as us Waste Poofs haven’t seen their " +
				"wooly hides here since the Void appeared I’d just as soon have you not here at all. We Waste Poofs will take care of the Void and those Void walker " +
				"monsters. You should just go home.", "maskedPoof", "Don't be too hasty leader. This Poof has impressed me quite a bit out in the Wastes.", 
				"resistanceLeader", "I say Humbug Masked Poof, you know as well as I do the Council is full of a bunch of ninnys. " +
				"Hmmm? What’s that? You’re going to help? You’re not going to fill out some form to ask the council if you can? Now there’s a Poof I could float beside.");
			TText[30] = new Array();
			Trains[30] = new Array(0,0);
			Arrows[30] = new Array(1,0,0,0);
			NPCs[30] = new Array("maskedPoof", "You made it!", "resistanceLeader", "From the Council huh? Light this Source and we'll start the meeting.", "oldWastePoofMale", "I can't talk to you.");
			Maps[31] = Res.MapThirtyOne;
			SText[31] = new Array("resistanceLeader", "Poof Resistance Leader: Be wary out here, the Wastes are dangerous, but the Void is far worse. And remember a good Waste Poof always knows where their chickens are.");
			EText[31] = new Array("maskedPoof", "The Masked Poof: Oho, I see...");
			TText[31] = new Array();
			Trains[31] = new Array();
			Arrows[31] = new Array(2,1,1,1);
			NPCs[31] = new Array("maskedPoof", "The Masked Poof: Don’t think I’m following you because I think you're cool or something. " +
				"I just think you’re a bit interesting. Plus, I want to see if you can restore the Sources even some of us Waste Poofs can’t manage.",
				"resistanceLeader", "RIGHT");
			Maps[32] = Res.MapThirtyTwo;
			SText[32] = new Array();
			EText[32] = new Array();
			TText[32] = new Array();
			Trains[32] = new Array();
			Arrows[32] = new Array(3,2,2,3);
			NPCs[32] = new Array("maskedPoof", "The Masked Poof: The Leader told me that twenty years ago this place used to be just as green as the grand Poof city you came from. Looking at this barren rock " +
				"though I can’t help but think his little wooly noggin might be dimming just a bit");
			Maps[33] = Res.MapThirtyThree;
			SText[33] = new Array("maskedPoof", "The Masked Poof: I suppose I should tell you that we weren’t just stealing Sources for the fight. We wanted all of those city Poofs comfortable back at home to know what " +
				"exactly is waiting for them out here. We retreat further and further from our homeland and this barren space grows larger and larger.",
				"maskedPoof", "The council is just ignoring it, but eventually the Void walkers will be in their homeland too. " +
				"If the city Poofs don’t grow some wool soon, they’ll be displaced just like we were.");
			EText[33] = new Array();
			TText[33] = new Array();
			Trains[33] = new Array();
			Arrows[33] = new Array(1,1,2,2);
			NPCs[33] = new Array("maskedPoof", "What a terrible place.");
			Maps[34] = Res.MapThirtyFour;
			SText[34] = new Array();
			EText[34] = new Array();
			TText[34] = new Array();
			Trains[34] = new Array();
			Arrows[34] = new Array(1,1,1,1);
			NPCs[34] = new Array("maskedPoof", "The Masked Poof: I’ve never been out this far, maybe we should turn back.");
			
			Maps[35] = Res.MapThirtyFive;
			SText[35] = new Array("maskedPoof", "Hey, the leader told me not to tell you this, but I think I should before we continue any further. Have you ever wondered " +
				"what happens when you combine all four elements on the Source Forge? Well I’ll tell you, you become Void.",
				"maskedPoof", "It’s a giant vacuum that sucks in everything. You might be thinking you could get past any obstacle, and you’d be right, but it sucks in and" +
				" darkens Sources too so it’s just too dangerous.");
			EText[35] = new Array("maskedPoof", "The Masked Poof: You really did it; you turned into Void even though I told you not to. I think I’m going back now. You’ve become too risky a Poof to stay around.");
			TText[35] = new Array("All Elements Combined on the forge will turn you into a Void Elemental," +
				"But be careful, if you touch a Source while you're a Void Elemental it will suck the life" +
				"right out.");
			Trains[35] = new Array();
			Arrows[35] = new Array(1,0,2,2);
			NPCs[35] = new Array("maskedPoof", "The Masked Poof Interaction: I said it’s too dangerous.");
			
			Maps[36] = Res.MapThirtySix;
			SText[36] = new Array("voiceOnTheWind", "Voice on the Wind: What’s this life I feel getting closer? " +
				"I haven’t felt life in so long… It feels… It feels… Delicious.");
			EText[36] = new Array();
			TText[36] = new Array();
			Trains[36] = new Array(1,1,1,1,1);
			Arrows[36] = new Array(1,2,1,1);
			NPCs[36] = new Array();
			
			Maps[37] = Res.MapThirtySeven;
			SText[37] = new Array("voiceOnTheWind", "Voice on the Wind: Wander closer little Poof ball, I won’t bite. I sense in you a similar mind as my own. " +
				"The Void is so vast. Won’t you enjoy the sensation with me?");
			EText[37] = new Array();
			TText[37] = new Array("...");
			Trains[37] = new Array(1,1,1,1,1);
			Arrows[37] = new Array(4,0,3,3);
			NPCs[37] = new Array();
			
			Maps[38] = Res.MapThirtyEight;
			SText[38] = new Array("voiceOnTheWind", "Voice on the Wind: Ahaha, don’t fight the Void. Let the emptiness take over. Surrender your thoughts to the " +
				"vast nothingness and enjoy eternity. This planet and the life on it are so small in comparisons. Like tiny little candles just waiting to be snuffed out when I’ve taken all the air.");
			EText[38] = new Array();
			TText[38] = new Array("...");
			Trains[38] = new Array();
			Arrows[38] = new Array(12,0,5,6);
			NPCs[38] = new Array();
			
			Maps[39] = Res.MapThirtyNine;
			SText[39] = new Array("voiceOnTheWind", "Voice on the Wind: Just a little further. Just one more test and you can bask " +
				"in its awesome presence. You must be tired. Why don’t I let you take a nice… long… rest.");
			EText[39] = new Array();
			TText[39] = new Array("...");
			Trains[39] = new Array(1,1,1,1,1);
			Arrows[39] = new Array(2,2,2,2);
			NPCs[39] = new Array();
			Maps[40] = Res.MapFourty;
			SText[40] = new Array("boss", "The Void: So here you are at last. I must say, you are very impressive. You remind me of… well me " +
				"when I still had a body, before I was a Void Source that is. Would you believe I was once a member of the council of elders? I remember we used to talk about the most mundane of things.",
				"boss", "They always wanted to double and triple check their documentation; making sure every t was crossed and i dotted. I decided to take matters into my own hands and now look " +
				"at me: Most powerful being on the whole Poof planet. I can’t wait to see the look on all their stupid little bureaucratic faces when I suck in everything that’s left of this dumb little world.",
				"boss", "Hmmm, but first, what should I do with you? I know, why don’t I let the monsters decide! Monsters!!!");
			EText[40] = new Array("boss", "The Void: Ahaha, I suppose everything has to end, but you should know what you’ve really accomplished. This Void was all that stood between you Poofs and everything beyond. " +
				"This world’s far bigger than you can even imagine.", "boss", "But celebrate for now little Poof. You’ve just opened the floodgate.");
			TText[40] = new Array("...");
			Trains[40] = new Array(1,1,1,1,1);
			Arrows[40] = new Array(0,2,1,1);
			NPCs[40] = new Array();
			
			//log that player is in the game, good for seeing if people quit w/o playing
			Log.startDquest(Logging.IN_GAME);
			
			var launchClass:Class;
			
			if (MODE == NORMAL_MODE) {
				launchClass = MenuState;
			} else if (MODE == FACEBOOK_MODE) {
				launchClass = FacebookPreloader;
			}
			super(700, 640, launchClass, 1, 60, 30);
			
			
			
		}

//		private function handleStats(e:Event):void {
//			var stats:String = e.target.data;
//			if (stats.charAt(0) != "E") {
//				var statArray:Array = stats.split(":");
//				achievements.initializeWithStats(
//					statArray[0], //level
//					statArray[1], //monsters
//					statArray[2], //chickens
//					statArray[3], //challenges beaten
//					statArray[4], //challenges issued
//					statArray[5], //pacifist
//					statArray[6], //maps created
//					statArray[7], //maps beated
//					statArray[8], //friends beaten
//					statArray[9]); //invites
//			}
//		}
	}
}
